package tech.aistar.mapper.authordis;

import org.apache.ibatis.annotations.Select;
import tech.aistar.entity.authordis.Notes;
import tech.aistar.entity.authordis.UserTable;

import java.util.List;

/**
 * Created by lenovo on 2019/9/28.
 */
public interface INoteTravelerDisMapper {

    /**
     * 查询达人发表的文章信息
     * @return
     */
    @Select("select * from notes where note_type = 1 and obtain = 0")
    List<Notes> findNoteByHot();

    /**
     * 查询达人发表的新作部分文章信息,根据后台获取的时间
     * @return
     */
    @Select("select * from notes where obtain=0 and note_type=1 and publish_time>=str_to_date(#{value},'%Y-%m-%d')")
    List<Notes> findNoteByTime(String time);

    /**
     * 查询用户id
     * @param authorId
     * @return
     */
    @Select("select user_id from note_author where id = #{value}")
    Integer findUserIdByAuthorId(Integer authorId);

    /**
     * 查询用户的信息
     * @param id
     * @return
     */
    @Select("select * from user_table where id =#{value}")
    UserTable findUserById(Integer id);

}
